package spring.cloud.tasks.common.task;

import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import java.util.Date;

@Slf4j
@Setter
@Getter
public class TaskItemExecuteRenewalInfo {
    protected String taskId;
    protected String taskInstanceId;
    protected String taskStage;
    protected String taskStage$type;
    protected int taskStage$type$index;

    public TaskItemExecuteRenewalInfo(String taskId, String taskInstanceId, String taskStage, String taskStage$type, int taskStage$type$index) {
        this.taskId = taskId;
        this.taskInstanceId = taskInstanceId;
        this.taskStage = taskStage;
        this.taskStage$type = taskStage$type;
        this.taskStage$type$index = taskStage$type$index;
    }

    protected String executorId;
    @JSONField(name = "nextFireDate", format = "yyyy-MM-dd HH:mm:ss")
    private Date nextFireDate;//指的是可以触发的时间
    /**
     * lockDateTime=timeoutDateTime+基于超时时间的时间间隔。这个值是动态的，这样设计更好。如果是一个固定的值，可能在程序编码的时候，会造成lockDateTime<timeoutDateTime的情况
     */
    @JSONField(name = "timeoutDateTime", format = "yyyy-MM-dd HH:mm:ss")
    private Date timeoutDateTime;//超时时间
    @JSONField(name = "lockDateTime")
    private Date lockDateTime;//锁时间
    //
    protected Long lastCalculatedMaxAllowRunningTime;//任务执行最大允许的执行时间
    protected Long lastCalculatedMaxRenewalTime;//续期时间
    private String preAssignCancel = "";
    private int status;
    protected String message;
    //
    private Long beginTime;
    private Long reportTime;
}
